<%@ page import="photobox.account.User" %>
<g:render template="../home/header" ></g:render>

<script>
    function confirmReceive(){
        if(!confirm("确认收到货物后再执行确认收货操作，以防钱货两空！")){
            return false
        }
        var orderId = $("#orderId").html().substr(4);
        $.ajax({
            type:"POST",
            url:"<g:createLink controller='order' action='orderItems'/>",
            data:{orderId:orderId,json:1},
            dataType:'json',
            beforeSend:function(){
            },
            success:function(data){
                if(data.status){
                    $("#orderStatus").html("订单状态：已收货");
//                    $("#query").type("hidden");
//                    $("#confirmReceive").type("hidden");
                    $("#query").html("");
                    $("#confirmReceive").html("");
                }else{
                    sAlert("操作失败");
                }
            },
            error: function (data, status, e)//服务器响应失败处理函数
            {
                alert(e+'没有发现');
            }
        });
    }
</script>
<!--主体-->
<div class="wid_1200 mTo_20">
    <div class="f_l">
        <div class="left_blk mBo_20 load_blk_ying">
            <div class="user_blk"><g:if test="${session.userId}">
                <div class="user_head"><!--<div class="user_head"><img src="../${user?.photoImage}" alt="头像"></div>-->
                    <g:if test="${photobox.account.User.get(session.userId)?.photoImage}">
                        <img src="../${User.findById(session.userId)?.photoImage}"  alt="头像" />
                    </g:if>
                    <g:else>
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="${resource(dir: '/assets/img', file: 'headp_140.jpg')}" alt="photobox" class="userPic"></a>
                    </g:else>
                </div>
            </g:if>
            </div>
            <!--nav-->
            <div class="nav_left bor4" style=" height:108px;">
                <ul class="">
                    <li><g:link controller="member" action="browserHistory"><span class=" tubiao4 tubiao4_1">&nbsp;</span>我浏览的作品</g:link></li>
                    <li><g:link controller="member" action="purchasedPhoto"><span class=" tubiao4 tubiao4_2">&nbsp;</span>我购买的作品</g:link></li>
                </ul>
            </div>
            <!--/nav-->
        </div>
        <!--/用户简介-->
        <div class="left_blk pBo_20">
            <div class="sJiao"><div class="jiao1"></div></div>
            <div class="user_jianj">
                <p>${User.findById(session.userId)?.presentation}</p>
            </div>
        </div>
        <!--/用户简介-->
        <div class="kong_100 clear"></div>
    </div>

    <!--blk3-->
    <div class="blk3 f_r load_blk_ying bor1">
        <div class="crumbs mLe_20">
            <span>个人信息</span><em class="tubiao2">&nbsp;</em><span>我的订单</span><em class="tubiao2">&nbsp;</em><span>订单详情</span>
        </div>
        <div class="blk3_2 Pa_30">
            <span id="orderStatus">订单状态：<g:if test="${order.orderStatus == 10}">未付款</g:if>
                             <g:elseif test="${order.orderStatus == 20}">已付款</g:elseif>
                             <g:elseif test="${order.orderStatus == 30}">制作中</g:elseif>
                             <g:elseif test="${order.orderStatus == 40}">已发货</g:elseif>
                             <g:elseif test="${order.orderStatus == 50}">已收货</g:elseif>
            </span>
            <g:if test="${order.orderStatus == 40}">
            <div class="zt_xk" id="query"><a href="###" id="chakan" class="annui annui1 mRi_20" data-placement="bottom" title="物流状态" data-container="body" data-toggle="popover" data-content="
                        <ul>
                            <li>
                                <p>支付宝交易号：2014040311001001230051201712</p>
                                <p>2014-9-22,10:34:00,到达北京分配点，正在审核...</p>
                            </li>
                            <li>
                                <p>支付宝交易号：2014040311001001230051201712</p>
                                <p>2014-9-22,10:34:00,到达北京分配点，正在审核...</p>
                            </li>
                        </ul>
                        ">查看物流</a> <a href="###" class="annui annui2" id="confirmReceive" onclick="confirmReceive()">确认收货</a></div>
            </g:if>
            <script>
                $(function () { $("#chakan").popover({html : true });});
            </script>
        </div>
        <div class="heng_line clear"></div>

        <div class="blk3_2 Pa_20">
            <div class="mBo_20 green">基本信息</div>
            <p>
                <span class="mRi_50" id="orderId">订单号：${order.id}</span><span>下单时间：${order.dateCreated.format("yyyy-MM-dd HH:mm:ss")}</span>
            </p>
        </div>
        <div class="heng_line clear"></div>

        <div class="blk3_2">
            <div class=" Pa_20 green">买家信息</div>
            <div class="pLe_20 pRi_20" style="background: #fafafa;">
                <p class="p3">用户名：${user.nickName}</p>
                <p class="p3">姓&nbsp;&nbsp;&nbsp;&nbsp;名：${user.realName}</p>
                <p class="p3">地&nbsp;&nbsp;&nbsp;&nbsp;址：${user.address[0].address}</p>
                <p class="p3">邮&nbsp;&nbsp;&nbsp;&nbsp;编：${user.address[0].postCode}</p>
                <p class="p3">电&nbsp;&nbsp;&nbsp;&nbsp;话：${user.cellPhone}</p>
            </div>
        </div>

        <div class="kong_20"></div><div class="kong_20"></div>

        <div class="blk3_1 mTo_20">
            <div class=" Pa_20 green">商家信息</div>
            <div class="table_qu">
                <table class="table1" width="100%">
                    <thead>
                    <tr>
                        <th width="20%">名称</th>
                        <th width="10%">价格</th>
                        <th width="10%">数量</th>
                    </tr>
                    </thead>
                    <tbody>
                    <g:each var="item" in="${order.items}">
                        <tr>
                            <td>${item.photo.name}</td>
                            <td class="orange">￥${Math.round(item.photo.price)}</td>
                            <td>${item.number}</td>
                        </tr>
                    </g:each>

                    </tbody>
                </table>
                <div class="jiaqu">
                    <p class="p2"><label class="label_2">合计：</label><em>￥${Math.round(order.totalPrice)}</em></p>
                    <p class="p2"><label class="label_2">运费：</label><em>￥20</em></p>
                    <p class="p2"><label class="label_2">总价：</label><em class="orange">￥${Math.round(order.totalPrice+20)}</em></p>
                </div>
            </div>
        </div>
        %{--<div class="bottomBor"></div>--}%%{--遮住底部阴影--}%
    </div>
</div>
<!--/主体-->


<g:render template="../home/footer" ></g:render>






%{--
<!--主体-->
<div class="h_main wid_1000">

    <div class="left_blk f_l">
        <!--用户介绍-->
        <div class="user_blk">
            <div class="user_head"><img src="../${User.findById(session.userId)?.photoImage}" alt="头像" /></div>
            <div class="user_jianj bor1">
                <p>${User.findById(session.userId)?.presentation}</p>
            </div>
        </div>
        <!--/用户介绍-->
        <div class="heng_line mBo_10"></div>
        <!--nav-->
        <div class="nav">
            <ul class="nav_ul">
                <li class="hit"><a href="###">个人信息</a></li>
                <li><a href="###">我浏览的作品</a></li>
                <li><a href="###">我购买的作品</a></li>
            </ul>
        </div>
        <!--/nav-->
        <div class=""></div>
    </div>
    <div class="blk3 f_r">

        <input type="button" value="查看物流">
        <input type="button" value="确认收货">
        <div class="kong_20"></div><div class="kong_20"></div>
    </div>
</div>
<!--/主体-->--}%
